package T31_T40;

import datastructure.TreeNode;
public class T38 {

    //递归，将左结点变成右结点即可
    public TreeNode invertTree(TreeNode root) {
        if (root==null)return null;
        TreeNode tempNode = new TreeNode();
        tempNode=root.left;
        root.left=root.right;
        root.right=tempNode;
        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}
